select ' INSERT INTO payrollsummary(DTRLINKNAME,PAYROLLCODE,BASICMONTHLY,BASICDAILY,ALLOWANCE,GASALLOWANCE,SSSDED,PHDED,PIDED,CADED,TAXDED,PILOANDED,ABSTARD,SSSLOANDED,COMPANYLOANDED,OTHERS,COMMENTS,OTPAY,EMPBRANCH,ADJUSTMENTS,PAYROLLDATEKEY,BRANCHCODE) VALUES (' 
+ '''' + ISNULL(DTRLINKNAME,'')
+ ''',' + ISNULL(str(PAYROLLCODE,10,2),'Null')
+ ',' + ISNULL(str(BASICMONTHLY,10,2),'Null')
+ ',' + ISNULL(str(BASICDAILY,10,2),'Null')
+ ',' + ISNULL(str(ALLOWANCE,10,2),'Null')
+ ',' + ISNULL(str(GASALLOWANCE,10,2),'Null')
+ ',' + ISNULL(str(SSSDED,10,2),'Null')
+ ',' + ISNULL(str(PHDED,10,2),'Null')
+ ',' + ISNULL(str(PIDED,10,2),'Null')
+ ',' + ISNULL(str(CADED,10,2),'Null')
+ ',' + ISNULL(str(TAXDED,10,2),'Null')
+ ',' + ISNULL(str(PILOANDED,10,2),'Null')
+ ',' + ISNULL(str(ABSTARD,10,2),'Null')
+ ',' + ISNULL(str(SSSLOANDED,10,2),'Null')
+ ',' + ISNULL(str(COMPANYLOANDED,10,2),'Null')
+ ',' + ISNULL(str(OTHERS,10,2),'Null')
+ ',''' + ISNULL(COMMENTS,'')
+ ''',' + ISNULL(str(OTPAY,10,2),'Null')
+ ',''' + ISNULL(EMPBRANCH,'')
+ ''',' + ISNULL(str(ADJUSTMENTS,10,2),'Null')
+ ',' + ISNULL(str(PAYROLLDATEKEY,4),'Null')
+ ',' + ISNULL(str(BRANCHCODE,4),'Null')
+ ')' from payrollsummary order by PAYROLLSUMMARYKEY


select * from PAYROLLDATES


